import { ConfigFactory } from '@nestjs/config';

import scheduleConfig from '../../.schedule.config';
import { type IScheduleConfig } from '../interface.d';

export type IEnvConfig = Record<'port' | 'host' | 'user' | 'pass', string>;

export type IConfiguration = IScheduleConfig & {
  /**
   * @description 服务端口
   */
  serverPort: number;

  /**
   * @description 静态服务相关
   */
  staticServer: Record<'localPath' | 'prefix', string>;
};

const configDefault: ConfigFactory<IConfiguration> = () => ({
  ...scheduleConfig,
  serverPort: 6700,

  staticServer: {
    /**
     * @description 本地静态文件目录
     */
    localPath: 'static',

    /**
     * @description 接口前缀
     */
    prefix: 'static',
  },
});

export default configDefault;
